package cn.common.autoconfigure;

import cn.common.exception.DefaultExceptionAdvice;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ExceptionAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean // 确保用户未自定义同名处理器时才会生效
    public DefaultExceptionAdvice globalExceptionHandler() {
        return new DefaultExceptionAdvice();
    }
}
